
<!--
/**************************************************
* @ ordermanufactureview4u.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/12, Jenny Li
*  v1.01, 2006/03/17, simonyi Peng
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hitrust.gs.business.GSManufactureProcessor"%>
<%@ page import="com.hitrust.gs.bean.GSManufactureBean"%>
<%@ page import="com.hitrust.gs.bean.GSManufactureCategoryBean"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<html>
<head>
<title>产品浏览</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>
<%
	ArrayList tManuf1 = (ArrayList)request.getAttribute("manufacture1");
	HashMap tMap1 = (HashMap)request.getAttribute("manufacturetyp2");
	HashMap tMap2 = (HashMap)request.getAttribute("manufacturetyp3");
	
	ArrayList tList = new ArrayList();
	
	GSManufactureVO vo = (GSManufactureVO)session.getAttribute("QUERYCONDITION");
	ResultProcess tGSManuf = (ResultProcess)request.getAttribute("manufacture");
%>
<script language="JavaScript">
	var counter;
	function process(){
        manufactureform.iskeywordquery.value="F";
        manufactureform.isupdate.value="T";
		manufactureform.action = "<%=response.encodeURL(root+"/A100505.do")%>";
		manufactureform.submit();
	}
	
	function processkey(){
        manufactureform.iskeywordquery.value="T";
        manufactureform.isupdate.value="T";
		manufactureform.action = "<%=response.encodeURL(root+"/A100505.do")%>";
		manufactureform.submit();
	}
function change1(optval){
  var val = optval;
  if(val=='0'){
    var listbox = document.getElementById("manuftype2");
    listbox.length = 0;
    var option = new Option();
    option.text = "---二级---";
    option.value = "0";
    listbox.options[listbox.length] = option;
    change2(optval);
  }else{
      var counter="0";
    <%if(tMap1 !=null){
      Collection tCollection = tMap1.keySet();
      Iterator tIterator = tCollection.iterator();
      while(tIterator.hasNext()){
        String tKey = (String)tIterator.next();
        tList = (ArrayList)tMap1.get(tKey);%>
        if(val == '<%=tKey%>'){
		  counter = "1";
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;
          <%
	          	for(int n=0;n<tList.size();n++){
		            GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
		            String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
		            String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
		            var temp1 = '<%=categoryId%>';
		            var temp2 = '<%=categoryName%>';
		            var option = new Option();
		            option.value = temp1;
		            option.text = temp2;
		            listbox.options[listbox.length] = option;
           <%
	       		}
           %>
			change2('0');           
         }
         
    <%
    	}
    %>
    	if(counter == '0'){
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;  
          change2('0');    	
    	}
    <%  
    }
    %>
   }
}
    function change2(optval){
      var val = optval;
      if(val=='0'){
        var listbox = document.getElementById("manuftype3");
        listbox.length = 0;
        var option = new Option();
        option.text = "---三级---";
        option.value = "0";
        listbox.options[listbox.length] = option;

      }else{
      	var counter = "0";
        <%if(tMap2 !=null){
          Collection tCollection = tMap2.keySet();
          Iterator tIterator = tCollection.iterator();
          while(tIterator.hasNext()){
            String tKey = (String)tIterator.next();
            tList = (ArrayList)tMap2.get(tKey);%>
            if(val == '<%=tKey%>'){
              counter = "1";
              var listbox = document.getElementById("manuftype3");
              listbox.length = 0;
              var option = new Option();
              option.text = "---三级---";
              option.value = "0";
              listbox.options[listbox.length] = option;
              <%for(int n=0;n<tList.size();n++){
                GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
                String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
                String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
                var temp1 = '<%=categoryId%>';
                var temp2 = '<%=categoryName%>';
                var option = new Option();
                option.value = temp1;
                option.text = temp2;
                listbox.options[listbox.length] = option;
                <%}%>
              }
          <%
          }
          %>
          if(counter == '0'){
		        var listbox = document.getElementById("manuftype3");
		        listbox.length = 0;
		        var option = new Option();
		        option.text = "---三级---";
		        option.value = "0";
		        listbox.options[listbox.length] = option;          
          }
          <%
            }%>
          }
        }	
	
	function openwin(value){
		showModalDialog("<%=response.encodeURL(root+"/jsp/showimage.jsp")%>?path="+value,window,"status:no;unadorned:yes;dialogWidth:375px;dialogHeight:400px;help:no;");
	}
	
	function writeback(){
		var currentrownum = opener.document.getElementById('currentrownum').value;
		var selectnum = 0;
		var radiobox = document.getElementsByName("ckbox");
		for(i=0;i<radiobox.length;i++){
			if(radiobox[i].checked){
				var values = tokenize(radiobox[i].value,'|');
				
				if (opener.document.getElementById("concentricityid_"+currentrownum) != null)
						opener.document.getElementById("concentricityid_"+currentrownum).value = values[0];			
				
				opener.document.getElementById("concentricityid"+currentrownum).value=values[0];
				opener.document.getElementById("manufacturename"+currentrownum).innerHTML=
				"<div align='center' class='txt_content'><a href='<%=response.encodeURL(root+"/A100503.do")%>?concentricityId="+values[0]+"' target=_blank>"+values[1]+"</a></div>";
				opener.document.getElementById("manufacturespec"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[2]+"</div>";
				opener.document.getElementById("manufacturetype"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[3]+"</div>";
				opener.document.getElementById("manufacturebrand"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[4]+"</div>";
				opener.document.getElementById("manufactureunitprice"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[5]+"</div>";
				//id
				if(opener.document.getElementById("manufactureid"+currentrownum) != null){
					opener.document.getElementById("manufactureid"+currentrownum).value=values[6];
				}
				//quant_unit
				if(opener.document.getElementById("quantUnit"+currentrownum) != null){
					opener.document.getElementById("quantUnit"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[7]+"</div>";
				}
				//quality_assure_period
				if(opener.document.getElementById("period"+currentrownum) != null){
					opener.document.getElementById("period"+currentrownum).innerHTML="<div align='center' class='txt_content'>"+values[8]+"</div>";
				}
				if(opener.document.getElementById("providerid"+currentrownum) != null){
					opener.document.getElementById("providerid"+currentrownum).innerHTML=
					"<div align='center' class='txt_content'><a href='<%=response.encodeURL(root+"/A150504.do")%>?providerId="+values[9]+"' target=_blank>"+values[10]+"</a></div>";
				}
                if(opener.document.getElementById("divmode"+currentrownum) != null){
                    opener.document.getElementById("divmode"+currentrownum).innerText=values[12];                   
                }
                if(opener.document.getElementById("mode"+currentrownum)!=null){
                    opener.document.getElementById("mode"+currentrownum).innerText=values[11];
                }
				selectnum++;
			}
		}

		if(selectnum==0){
			alert("请至少选择一个集中编码");return false;
		}
		window.close();		
	}
	
	function cls(){
		document.all.manuftype1.options[0].selected = true;
		document.all.manuftype2.options[0].selected = true;
		document.all.manuftype3.options[0].selected = true;
		document.all.concentricityId.value = "";
		document.all.manufactureName.value = "";
		document.all.manufactureSpec.value = "";
		document.all.manufactureType.value = "";
		document.all.manufactureBrand.value = "";
		document.all.manufacturerName.value = "";
        document.all.balancemode.value="";
	}
</script>
</head>
<body BGCOLOR="#f2f2f2"	text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<p><br></p>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">产品查询</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>

<br>


<form name="manufactureform" method="get" >
<input type='hidden' name='iskeywordquery' value="<%=request.getParameter("iskeywordquery") %>">
<input type='hidden' name='isupdate' value="<%=request.getParameter("isupdate") %>">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				
				<TR height=20>
					<TD class="bg_column" align=center>产品分类</TD>
					<TD left=right class="bg_row_odd" colspan=3>
						<select name="manuftype1" onChange="change1(this.value)">	
						<option value="0">---一级---</option>				
						<%
							String tManufType1 = vo==null?"":vo.gs_manufacture_category1;
							//int iManuType1 = 0;
							if(tManuf1 != null && tManuf1.size() > 0 ){
							    if(tManufType1 != null){
							        //iManuType1 = Integer.parseInt(tManufType1);
							    }
								for(int i=0; i<tManuf1.size(); i++){
								    GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tManuf1.get(i);
								    if(tManufType1!=null && tManufType1.equals(tGSManufactureBean.getGs_manufacture_category_id())){
								        
						%>
								<option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>" selected>
								<%=tGSManufactureBean.getGs_manufacture_category_name()%></option>
						<%			        
								    }else{
						%>
								<option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>">
								<%=tGSManufactureBean.getGs_manufacture_category_name()%></option>
								
						<%			}	
								}
							}
						%>

						</select>
						<select id="manuftype2" name="manuftype2" onChange="change2(this.value)">	
						<option value="0">---二级---</option>				
						<%
							String tManufType2 = vo==null?"":vo.gs_manufacture_category2;
							if(tManufType1 != null && !tManufType1.equals("0")){
							    //int tIntManuType2 = Integer.parseInt(tManufType2);
							    ArrayList temp = (ArrayList)tMap1.get(tManufType1);
							    if(temp != null ){
								for(int i=0; i<temp.size(); i++){
								    GSManufactureCategoryBean tGSManuf2 = (GSManufactureCategoryBean)temp.get(i);
								    if(tManufType2!=null && tManufType2.equals(tGSManuf2.getGs_manufacture_category_id())){
						%>
								<option value="<%=tManufType2%>" selected><%=tGSManuf2.getGs_manufacture_category_name()%></option>
						<%			        
								    }else{
						%>
								<option value="<%=tGSManuf2.getGs_manufacture_category_id()%>"><%=tGSManuf2.getGs_manufacture_category_name()%></option>
								
						<%			}	
								}
								}
							}
						%>

						</select>
						<select name="manuftype3" id="manuftype3">	
						<option value="0">---三级---</option>				
						<%
							String tManufType3 = vo==null?"":vo.gs_manufacture_category3;
							if(tManufType2 != null && !tManufType2.equals("0") ){
							   // int tIntManufType3 = Integer.parseInt(tManufType3);
							    ArrayList temp = (ArrayList)tMap2.get(tManufType2);
							    if(temp != null ){
								for(int i=0; i<temp.size(); i++){
								    GSManufactureCategoryBean tGSManuf3 = (GSManufactureCategoryBean)temp.get(i);
								    if(tManufType3!=null && tManufType3.equals(tGSManuf3.getGs_manufacture_category_id())){
						%>
								<option value="<%=tGSManuf3.getGs_manufacture_category_id()%>" selected><%=tGSManuf3.getGs_manufacture_category_name()%></option>
						<%			        
								    }else{
						%>
								<option value="<%=tGSManuf3.getGs_manufacture_category_id()%>"><%=tGSManuf3.getGs_manufacture_category_name()%></option>
								
						<%			}	
								}
								}
							}
						%>

						</select>
					</TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>集中编码</TD>
					<TD align=left class="bg_row_odd" width="300"><input type="text" name="concentricityId" value="<%=vo==null? "":(vo.gs_concentricity_id==null?"":vo.gs_concentricity_id) %>"></TD>					
					<TD class="bg_column" align=center width="100">产品名称</TD>
					<TD align=left class="bg_row_odd" ><input type="text" name="manufactureName" value="<%=vo==null? "":(vo.gs_manufacture_name==null?"":vo.gs_manufacture_name) %>"></TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>规格</TD>
					<TD align=left class="bg_row_odd" width="300"><input type="text" name="manufactureSpec" value="<%=vo==null? "":(vo.gs_manufacture_spec==null?"":vo.gs_manufacture_spec) %>"></TD>					
					<TD class="bg_column" align=center width="100">型号</TD>
					<TD align=left class="bg_row_odd" ><input type="text" name="manufactureType" value="<%=vo==null? "":(vo.gs_manufacture_type==null?"":vo.gs_manufacture_type) %>"></TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>品牌</TD>
					<TD align=left class="bg_row_odd" width="300"><input type="text" name="manufactureBrand" value="<%=vo==null? "":(vo.gs_manufacture_brand==null?"":vo.gs_manufacture_brand) %>"></TD>					
					<TD class="bg_column" align=center width="100">生产厂商</TD>
					<TD align=left class="bg_row_odd" ><input type="text" name="manufacturerName" value="<%=vo==null? "":(vo.gs_manufacturer_name==null?"":vo.gs_manufacturer_name) %>"></TD>					
				</TR>
                <TR height=20>
                    <TD class="bg_column" align=center>结算模式</TD>
                    <TD align=left class="bg_row_odd" width="300">
                    <select name="balancemode">
                    <option value="" selected>---全部---</option>
                    <%String mode = vo==null?"":vo.gs_balance_mode;
                    if(mode==null){%>
                        <option value="<%=GSBaseConstants.BALANCE_MODE1 %>"><%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE1) %></option>
                        <option value="<%=GSBaseConstants.BALANCE_MODE2 %>"><%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE2) %></option>
                    <%}else{
                    
                    String[][] stocksstate = GSBaseManager.getbalancemode();
                    if(stocksstate != null && stocksstate.length > 0 ){
                    
                        for(int i=0; i<stocksstate.length; i++){
                                    String[] temp = stocksstate[i];
                                    if(mode != null && mode.equals(temp[0])){
                        %>
                                        <option value="<%=temp[0]%>" selected>
                                        <%=temp[1]%></option>
                        <%                  
                                    }else{
                        %>
                                        <option value="<%=temp[0]%>" >
                                        <%=temp[1]%></option>
                        <%          
                                    }
                                }
                            }
                        }
                        %>
                    
                  </select>
                    </TD>                   
                    <TD class="bg_column" align=center width="100"></TD>
                    <TD align=left class="bg_row_odd" ></TD>                  
                </TR>
			</table>
		</td>
	</tr>
</table>

    <p align="center">  
		<input type="button" class="kuang" value="查询" onclick="process()"/>&nbsp;
		<input type="reset" class="kuang" value="清空" />&nbsp;
    </p>
    
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<TR height=20>
					<TD class="bg_column" align=center width="110">关键字</TD>
					<TD align=left class="bg_row_odd" width="100"><input type="text" name="keyword" value="<%=request.getParameter("keyword")==null?"":request.getParameter("keyword")%>"></TD>	
					<TD class="bg_column" align=center colspan=2>
						<input type="button" value='查询' onclick="processkey()" class="kuang"/>&nbsp;
						<font color='red'>（对产品名称、型号、规格、品牌、生产厂商、附加属性等关键字的模糊查询） </font>
					</TD>
				</TR>
                <tr>
                        <%
                        if(tGSManuf != null) {
                            int totalRecords = 0;
                            if(request.getAttribute("totalRecords")!=null){
                                totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
                            }
                            int defaultPageSize =10;
                            if(request.getAttribute("pageSize")!=null){
                                defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
                            }
                        %>          
                        <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'></page:pager>
                        <%} %>
                </tr>
			</table>
		</td>
	</tr>
</table>
    
</form>
<%
	
	if(tGSManuf != null){
%>
	<center>
    <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
            <form name='pager' method="post">
            	<input type='hidden' name='fanye' value='T'>
            	<table class=bg_table id=tableId	cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20>
                    	<td class=top align=middle> 
                        <div align="center" class="txt_content">&nbsp;</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">集中编码</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品名称</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品规格</div>
						</td>
						<td class=top align=middle> 
                        <div align="center" class="txt_content">产品型号</div>
						</td>																																				
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">单位</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品品牌</div>
						</td>
						<td class=top align=middle> 
                        <div align="center" class="txt_content">生产厂商</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">结算模式</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">详细信息</div>
						</td>																							
					</tr>
					<%
						tList = tGSManuf.getAllRecoreds();
						if(tList != null && tList.size() > 0){
							ArrayList allProv = GSBaseManager.getAllProvider();
							
							for(int i=0; i<tList.size(); i++){
							String[] tStr = (String[])tList.get(i);
							String tTempStr="";
							if(i%2==0){
								tTempStr="class=\"bg_row_odd\"";
							}else {
								tTempStr="class=\"bg_row_even\"";
							}
							String provname = "";
							for(int provsize = 0;provsize < allProv.size();provsize++){
								GSProviderBean pb = (GSProviderBean)allProv.get(provsize);
								if(pb.getGs_provider_id().equals(tStr[12])){
									provname = pb.getGs_provider_shortname();
									break;
								}
							}
					%>
							<tr <%=tTempStr%> height=20>
								<td class=top align=middle> 
									<div align="center" class="txt_content"> 
									<input type='radio' name='ckbox' value='<%=tStr[1]+"|"+tStr[2]+"|"+tStr[7]+"|"+tStr[6]+"|"+tStr[4]+"|"+tStr[10]+"|"+tStr[0]+"|"+tStr[9]+"|"+tStr[11]+"|"+tStr[12]+"|"+provname+"|"+tStr[15]+"|"+DefineDic.getBalanceMode(tStr[15])+"|"%>'>
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[1]%>
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root+"/A100104.do")%>?concentricityId=<%=tStr[1]%>" target="_blank"><%=tStr[2]%></a>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[7]%>
									</div>
								</td>
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[6]%>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[9]%>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[4]%>
									</div>
								</td>		
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[5]%>
									</div>
								</td>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=DefineDic.getBalanceMode(tStr[15])%>
                                    </div>
                                </td>
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root+"/A100104.do")%>?concentricityId=<%=tStr[1]%>" target="_blank">详细</a>
									</div>
								</td>																	
							</tr> 
							
					<%	
							}
					%>
						  <tr class="bg_column" height=20>
						    <td width="960" height="16" colspan="10" align="right">
									<!--导航条-->
						    		<page:navigator type='text' queryForm='manufactureform'/>
						    </td>
						  </tr>
				    <%
						}else{
					%>
							<font color="red">没有符合条件的产品信息,请重新输入查询条件</font>
					<%
						}
					%>
					</tbody>
				</table>
				</form>					  
			</td>
		</tr>
	</table>
	</center>
	
<p>
<center>
	<input type="button" class="kuang" value="确定" onclick="javascript:writeback();return false;">
	<input type="button" class="kuang" value="返回" onclick="javascript:window.close();">
</center>
</p>	
<%		
	}
%>


</body>
</html>